package com.oa.service.impl;

import com.oa.mappers.LeaveMapper;
import com.oa.po.Leave;
import com.oa.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LeaveServiceImpl implements LeaveService {
    @Autowired
    LeaveMapper leaveMapper;

    @Override
    public int addLeave(Leave leave) {
        try {
            leaveMapper.addLeave(leave);
            return 1;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return 0;
    }

    @Override
    public List<Leave> findByUsername(String user_name) {
        return leaveMapper.findByUsername(user_name);
    }
}
